package com.seminario.dao;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Session;

import com.seminario.model.Perfil;
import com.seminario.util.HibernateUtil;

public class PerfilDao {
	
	public List<Perfil> getAllProfiles() {
        List<Perfil> perfiles = new ArrayList<Perfil>();
        Session session = HibernateUtil.getSessionFactory().openSession();
        try {
        	perfiles = session.createQuery("from Perfil").list();
        } catch (RuntimeException e) {
            e.printStackTrace();
        } finally {
            session.flush();
            session.close();
        }
        return perfiles;
    }

}
